<?php
// b/c we need pr() like f(x) in every file i'e include it on layout
require_once("includes/common.php");
error_reporting(~E_NOTICE);
$url  = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'];
//pr($_SESSION);

if(!isset($_SESSION['id']) && !empty($_GET)) {
  header('location:index.php');
}
?>
<!DOCTYPE html>
<!-- saved from url=(0055)http://twitter.github.com/bootstrap/examples/fluid.html -->
<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta charset="utf-8">
    <title>Bootstrap, from Twitter</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
  <script type="text/javascript" src="js/jquery-1.8.2.min.js"></script>

    <!-- Le styles -->
    <link href="./css/bootstrap.css" rel="stylesheet">
    <style type="text/css">
      body {
        padding-top: 60px;
        padding-bottom: 40px;
      }
      .sidebar-nav {
        padding: 9px 0;
      }
      .error {
        color: red;
      }
      .success {
        color: green;
      }
    </style>

    <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
      <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
  </head>

  <body>

    <div class="navbar navbar-inverse navbar-fixed-top">
      <div class="navbar-inner">
        <div class="container-fluid">
          <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </a>
          <a class="brand" href="#">Project name</a>
          <div class="nav-collapse collapse">
            <p class="navbar-text pull-right">
              Logged in as <a href="http://twitter.github123.com/bootstrap/examples/fluid.html#" class="navbar-link"><?=$_SESSION['email']?></a>
            </p>


            <ul class="nav">
              <li class="active"><a href="http://twitter.github123.com/bootstrap/examples/fluid.html#">Home</a></li>
              <li><a href="http://twitter.github123.com/bootstrap/examples/fluid.html#about">About</a></li>
              <li><a href="http://twitter.github123.com/bootstrap/examples/fluid.html#contact">Contact</a></li>
            </ul>
          </div><!--/.nav-collapse -->
        </div>
      </div>
    </div>

    <div class="container-fluid">
      <div class="row-fluid">
        <div class="span3">
          <div class="well sidebar-nav">
<?php if(isset($_SESSION['id'])) {?>
            <ul class="nav nav-list">
              <li class="nav-header">Sidebar</li>
              <li class="active"><a href="http://twitter.github123.com/bootstrap/examples/fluid.html#">Link</a></li>
              <li><a href="<?=$url?>?page=show_all_users">Show All users</a></li>
              <li><a href="<?=$url?>?page=register">Register</a></li>
              <li><a href="logout.php" class="navbar-link">Logout</a></li>
              <li class="nav-header">Sidebar</li>
              <li><a href="http://twitter.github123.com/bootstrap/examples/fluid.html#">Link</a></li>
              <li><a href="http://twitter.github123.com/bootstrap/examples/fluid.html#">Link</a></li>
              <li><a href="http://twitter.github123.com/bootstrap/examples/fluid.html#">Link</a></li>
              <li><a href="http://twitter.github123.com/bootstrap/examples/fluid.html#">Link</a></li>
              <li><a href="http://twitter.github123.com/bootstrap/examples/fluid.html#">Link</a></li>
              <li><a href="http://twitter.github123.com/bootstrap/examples/fluid.html#">Link</a></li>
              <li class="nav-header">Sidebar</li>
              <li><a href="http://twitter.github123.com/bootstrap/examples/fluid.html#">Link</a></li>
              <li><a href="http://twitter.github123.com/bootstrap/examples/fluid.html#">Link</a></li>
              <li><a href="http://twitter.github123.com/bootstrap/examples/fluid.html#">Link</a></li>
            </ul>
<?php }?>
          </div><!--/.well -->
        </div><!--/span-->
        <div class="span9">
          <!--<div class="hero-unit">
            <p>Hello put the messsage here.</p>
          </div> -->
          <div class="row-fluid">
            <div class="span11">
<!-----START INCLUDE PHP PAGES HERE ------->
          <?php
           $page = isset($_GET['page']) ? $_GET['page'] : '';

          switch($page){
            case 'edit_user':require_once('edit_user.php');break ;
            case 'view_profile':require_once('view_profile.php');break ;
            case 'show_all_users':require_once('show_all_users.php');
            break ;
            default:require_once('register.php');
          }
          ?>
<!-----END INCLUDE PHP PAGES HERE ------->
            </div><!--/span-->
          </div><!--/row-->

        </div><!--/span-->
      </div><!--/row-->

      <hr>

      <footer>
        <p>© Company 2012</p>
      </footer>

    </div><!--/.fluid-container-->
</body></html>
